package com.aaa.ss.service;

import com.aaa.common.bo.Order;
import com.aaa.ss.config.MyLoadBalancer;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * fileName:OrderService
 * description:
 * author: Mr.Ge
 * createTime:2020/11/19 9:18
 * version:1.0.0
 */
//name = "orderService" 必须和被调用的服务，在注册中心注册的名称一致
@FeignClient(name = "orderService",configuration = MyLoadBalancer.class)
public interface OrderService {
    /**
     * 调用远程订单
     * @GetMapping 请求方式必须和定义资源方式
     * 请求的资源uri必须和资源uri完全一致
     * @param order
     * @return
     */
    @PostMapping("/order/queryAll")
    List<Order> listOrder(@RequestBody Order order);

    /**
     * 对象调用
     * @param id
     * @return
     */
    @GetMapping("/order/selectOne")
    List<Order> getById(Integer id);
}
